//
//  NYSignInViewController.m
//  NiuWaJiaoYu
//
//  Created by MinLison on 2018/1/2.
//  Copyright © 2018年 niuwaketang. All rights reserved.
//

#import "NYSignInViewController.h"
#import "NYSignInRequest.h"
@interface NYSignInViewController ()

@end

@implementation NYSignInViewController
- (void)didInitialized {
        [super didInitialized];
        CGFloat w = __WGWidth(290);
        CGFloat h = __WGHeight(335);
        self.contentSizeInPopup = CGSizeMake(w,h);
        self.landscapeContentSizeInPopup = CGSizeMake(w,h);
}
- (void)viewDidLoad
{
        [super viewDidLoad];
        [self loadData];
}

- (void)loadData
{
        [self setLoading:YES animation:YES];
        [NYUserManager signInWithParam:nil success:^(NYUserModel * _Nonnull user) {
                self.controllerView.signInModel = NYUserManager.signInModel;
                [self setSuccess];
        } failed:^(NSError * _Nonnull error) {
                [self setError:error];
        }];
}
- (STPopupController *)getPopUpControllerWithDismiss:(void (^)(void))dismiss
{
        STPopupController *popupController = [[STPopupController alloc] initWithRootViewController:self];
        popupController.containerView.layer.cornerRadius = 4;
        popupController.navigationBarHidden = YES;
        popupController.style = STPopupStyleFormSheet;
        popupController.DissmissCallBack = ^{
                if (dismiss) {
                        dismiss();
                }
        };
        return popupController;
}
+ (UIViewController<JLRRouteDefinitionTargetController> *)targetControllerWithParams:(NSDictionary *)parameters
{
        NYSignInViewController *signInVC = [[NYSignInViewController alloc] init];
        
        return (UIViewController<JLRRouteDefinitionTargetController> *)[signInVC getPopUpControllerWithDismiss:nil];
}
@end
